import { useSelector } from 'react-redux';
import { AppStore } from '../../types';
import NotFoundPage from '../NotFoundPage';
import { IconCloud } from '@arco-design/web-react/icon';
import main from '@src/main';

export default function HomePage() {
  const user = useSelector((state: AppStore) => state.user);
  if (!user || (user.fetching && !user.loaded)) {
    return (
      <div className="bh-100 pt-200">
        <NotFoundPage loading />
      </div>
    );
  } else if (user.error) {
    return (
      <div className="bh-100 d-flex-r ai-center jc-center">
        <div>{user.error}</div>
      </div>
    );
  }

  return (
    <div className="page bh-100 d-flex-c ai-center jc-center font-20 text-primary-color">
      <IconCloud className="font-100" />
      欢迎使用{main.projectName}
    </div>
  );
}
